package javaCode.chapter07.poly_.detail_;

public class PolyDetail03 {
    public static void main(String[] args) {
        BB bb = new BB();
        System.out.println( bb instanceof AA); //t
        System.out.println( bb instanceof BB); //t

        //aa 的编译类型是 AA，运行类型是 BB
        AA aa = new BB();
        System.out.println(aa instanceof AA); //t
        System.out.println(aa instanceof BB); //t

        Object obj = new Object();
        System.out.println(obj instanceof AA); //f
        String str = "believe";
        System.out.println(str instanceof Object); //t
    }
}

class AA{} //基类
class BB extends AA{} //子类